package top.jacktgq.hsp.netty.inbound_outbound_handler.v1;

import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToByteEncoder;

/**
 * @Author CandyWall
 * @Date 2020/11/13--14:35
 * @Description
 */
public class MyLongToByteEncoder extends MessageToByteEncoder<Long> {
    //编码的方法
    @Override
    protected void encode(ChannelHandlerContext ctx, Long msg, ByteBuf out) throws Exception {
        System.out.println("MyLongToByteEncoder encode被调用了");
        System.out.println("msg=" + msg);
        out.writeLong(msg);
    }
}
